import request from '../../../utils/unirequest';
import type { AxiosResponse } from '../../../type/common';
import type { SearchResponse, SearchRequest, AddRequest, AddResponse, DetailResponse, ParticipationResponse, ParticipationSearchRequest } from './interface';

export default function useActivityApi() {
  // 活动中心接口
  return {
    // 活动列表
    search: (data: SearchRequest): Promise<AxiosResponse<SearchResponse[]>> => request.post("/api/sysactivitylist/search", data),
    // 添加参与活动
    add: (data: AddRequest): Promise<AxiosResponse<AddResponse>> => request.post("/api/sysactivityparticipation/add", data),
    // 活动详情 - 按照您的定义
    activityDetail: (ID: string): Promise<DetailResponse> => request.get(`/api/sysactivitylist/${ID}`),
    // 活动参与列表
    searchParticipation: (data: ParticipationSearchRequest): Promise<AxiosResponse<ParticipationResponse[]>> => request.post("/api/sysactivityparticipation/search", data),
    // 活动参与详情
    detail: (activityId: string): Promise<AxiosResponse<DetailResponse>> => request.get(`/api/sysactivityparticipation/${activityId}`),
  };
}